package com.nbsaas.sample.user.rest.convert;

import com.nbsaas.sample.entity.user.UserAccessLog;
import com.nbsaas.sample.user.api.domain.request.UserAccessLogDataRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.sample.entity.user.UserInfo;

/**
* 请求对象转换成实体对象
*/

public class UserAccessLogEntityConvert  implements Converter<UserAccessLog, UserAccessLogDataRequest> {
@Override
public UserAccessLog convert(UserAccessLogDataRequest source) {
UserAccessLog result = new UserAccessLog();
BeanDataUtils.copyProperties(source, result);
            if(source.getCreator()!=null){
            UserInfo creator =new UserInfo();
            creator.setId(source.getCreator());
            result.setCreator(creator);
            }
return result;
}
}

